--舍身突击
local sheshentuji = fk.CreateSkill {
    name = "mcdh_sheshentuji"
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

sheshentuji:addEffect('active',{
    card_filter = Util.FalseFunc,
    target_filter = Util.FalseFunc,
    can_use = function (self, player, card, extra_data)
        return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
    end,
    on_use = function (self, room, use)
        local player = room:getPlayerById(use.from)
        player:drawCards(3,self.name)
        local judge = {
            who = player,
            reason = self.name,
            pattern = ".",
        }
        room:judge(judge)
        room:setPlayerMark(player,"@mcdh_sheshentuji_ban",judge.card.number)
    end
})

sheshentuji:addEffect(fk.TurnStart,{
    can_refresh = function(self, event, target, player, data)
        return target == player and player:getMark("@mcdh_sheshentuji_ban") > 0
    end,
    on_refresh = function (self, event, target, player, data)
        player.room:setPlayerMark(player,"@mcdh_sheshentuji_ban",0)
    end
})

sheshentuji:addEffect('prohibit',{
    prohibit_use = function(self, player, card)
        return card and card.number < player:getMark("@mcdh_sheshentuji_ban") and card.number > 0
    end,
})

Fk:loadTranslationTable{
    ["mcdh_sheshentuji"] = "突击",
    [":mcdh_sheshentuji"] = "『舍身突击』<br>出牌阶段限一次，你可以摸三张牌，然后你进行一次判定，直到你的下个回合开始，你不能使用小于此判定牌点数的牌。",
    ["#mcdh_sheshentuji_prohibit"] = "舍身突击",
}
return sheshentuji